﻿<%@ Page Language="C#"  MasterPageFile="~/Views\Home\test.master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ContentPlaceHolderID="test" runat="server">
	<% if (Session["level"]!=null) { if (Html.Encode(Session["level"]) == "2" || Html.Encode(Session["level"]) == "3") { %>
	<script type="text/javascript">
	$(document).ready(function() {	
		$( "#borrowstart" ).datepicker({
			defaultDate: new Date(),
			dateFormat: 'M d, yy',
			selectDefaultDate: true
		});		
		$( "#borrowend" ).datepicker({
			dateFormat: 'M d, yy'
		});
	});
	</script>
	<% TestProject.User user = ViewData["user"] as TestProject.User; TestProject.Book book = ViewData["book"] as TestProject.Book; %>
	<div class="tab_container reserve">
  		<div class="sub_content">LEND BOOK</div>
  		&nbsp;<b>BOOK</b><br /><table>
  		<tr><td style="border:0; font-size: 16px;">ISBN:</td><td id="r_bookisbn" style="border:0; font-size: 16px;"><%= book.isbn %></td></tr>
  		<tr><td style="border:0; font-size: 16px;">Book Title:</td><td style="border:0; font-size: 16px;"><%= book.title %></td></tr>
  		<tr><td style="border:0; font-size: 16px;">Author:</td><td style="border:0; font-size: 16px;"><%= book.author %></td></tr>  
  		<tr><td style="border:0; font-size: 16px;">Publisher:</td><td style="border:0; font-size: 16px;"><%= book.publisher %></td></tr>  		
  		</table>
  		<input type="hidden" id="r_bookid" value="<%= book.book_ID %>" />
  		<input type="hidden" id="r_userid" value="<%= user.user_ID %>" />
  		<input type="hidden" id="r_reservationid" value="<%= Html.Encode(ViewData["reservation"]) %>" />
		<br />&nbsp;<b>USER</b><br /><table>  		
  		<tr><td style="border:0; font-size: 16px;">Username:</td><td style="border:0; font-size: 16px;"><%= user.username %></td></tr>
  		<tr><td style="border:0; font-size: 16px;">First Name:</td><td style="border:0; font-size: 16px;"><%= user.firstname %></td></tr>
  		<tr><td style="border:0; font-size: 16px;">Last Name:</td><td style="border:0; font-size: 16px;"><%= user.lastname %></td></tr>  
  		<tr><td style="border:0; font-size: 16px;">Email:</td><td style="border:0; font-size: 16px;"><%= user.email %></td></tr>  		
  		</table>
		<br />&nbsp;<b>LOAN INFO</b><br />
		<div class="error" id="r_enddate_error">Due date should be after start date.</div> 
		<div class="error" id="r_missing_error">Please enter a valid due date and valid start date.</div> 
		<div class="error" id="r_copy_error">No copies of the book are currently available.</div> 
		<table>
		<tr style="border:0; font-size: 16px;" ><td style="border:0; font-size: 16px;">Start Date:</td><td id="r_startdate" style="border:0; font-size: 16px;"> <input type="text" id="borrowstart" value="<%= Html.Encode(ViewData["currentDate"]) %>" /></td></tr>
		<tr style="border:0; font-size: 16px;"><td style="border:0; font-size: 16px;">Due Date:</td><td id="r_enddate" style="border:0; font-size: 16px;"> <input type="text" id="borrowend" value="<%= Html.Encode(ViewData["endDate"]) %>" /></td></tr>
		</table>
		<br /><input type="button" class="save_loan" value="Reserve" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="cancel_loan" value="Cancel" />
	</div>	
	<% }} %>
</asp:Content>